package druid;

import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.ast.statement.SQLExprTableSource;
import com.alibaba.druid.sql.ast.statement.SQLJoinTableSource;
import com.alibaba.druid.sql.ast.statement.SQLSelect;
import com.alibaba.druid.sql.ast.statement.SQLSelectQueryBlock;
import com.alibaba.druid.sql.ast.statement.SQLSelectStatement;
import com.alibaba.druid.sql.ast.statement.SQLTableSource;
import com.alibaba.druid.sql.dialect.hive.parser.HiveStatementParser;
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlSchemaStatVisitor;
import com.alibaba.druid.sql.parser.SQLParserUtils;
import com.alibaba.druid.sql.parser.SQLStatementParser;
import com.alibaba.druid.sql.visitor.SQLASTOutputVisitor;
import com.alibaba.druid.util.JdbcUtils;
import java.util.List;

public class Test3 {


    public static void main(String[] args) {

        String sql = "SELECT a.id,a.name,a.address,a.date,b.math,b.english,b.chinese FROM default.tb_demo065_tel AS b,tb_demo065 AS a WHERE a.id=b.id";

        sql = "SELECT a.id,a.name,a.address FROM default.tb_demo065_tel a";
        HiveStatementParser parse = new HiveStatementParser(sql);

        SQLStatement sqlStatement = parse.parseStatement();

        HiveSchemaStatVisitorRewriter rewriterVisitor = new HiveSchemaStatVisitorRewriter();

        sqlStatement.accept(rewriterVisitor);

    }
}
